#[test]
fn g1() {
    let muber_list = vec![1, 2, 3, 4, 9, 8];
    let s_list = vec!['y', 'm', 'a', 'b'];

    let muber_largest = largest(&muber_list);
    let s_largest = largest(&s_list);

    println!("{muber_largest} {s_largest}")
}

fn largest<T: std::cmp::PartialOrd>(list: &[T]) -> &T {
    let mut largest = &list[0];
    for item in list {
        if item > largest {
            largest = item
        }
    }
    largest
}

struct Point<T> {
    x: T,
    y: T,
}

impl<T> Point<T> {
    fn x(&self) -> &T {
        &self.x
    }
}

#[test]
fn g2() {
    let p = Point { x: 5, y: 9 };
    println!("{} {}", p.x(), p.y);
}

struct Point2<T1, T2> {
    x: T1,
    y: T2,
}

impl<T1, T2> Point2<T1, T2> {
    fn mixup<T11, T22>(self, other: Point2<T11, T22>) -> Point2<T1, T22> {
        Point2 {
            x: self.x,
            y: other.y,
        }
    }
}

#[test]
fn g3() {
    let p1 = Point2 { x: 5, y: 3.4 };
    let p2 = Point2 { x: 5.6, y: 'c' };

    let p3 = p1.mixup(p2);
    println!("{} {}", p3.x, p3.y);
}
